//
//  TXTCollectionView.m
//  ProjectA_LK
//
//  Created by 萌萌的小坤坤 on 16/6/14.
//  Copyright © 2016年 冷坤. All rights reserved.
//

#import "TXTCollectionView.h"
#import "UIImageView+WebCache.h"

#define WIDTH self.view.frame.size.width

#define HEIGHT self.view.frame.size.height

#define COLORS [UIColor colorWithRed:(arc4random() % 256 / 255.0) green:(arc4random() % 256 / 255.0) blue:(arc4random() % 256 / 255.0) alpha:1.0];

@implementation TXTCollectionView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatCollectionView];
    }
    return self;
}

- (void)creatCollectionView{
    self.titleImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 345 / 2, 170)];
    self.titleImage.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:self.titleImage];
    [_titleImage release];
    
    self.lview = [[LView alloc]initWithFrame:CGRectMake(0, self.titleImage.frame.size.height, self.titleImage.frame.size.width, 100)];
    self.lview.backgroundColor = COLORS;
    [self.contentView addSubview:self.lview];
    [_lview release];
    
}
-(void)setModel:(TXTModel *)model{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [self.titleImage sd_setImageWithURL:[NSURL URLWithString:model.host_pic]];
     self.lview.model = model;
}

-(void)dealloc{
    [_titleImage release];
    [_lview release];
    [super dealloc];
}
@end
